#!/usr/bin/perl -w
  
use Data::Faker;

@LoC = (["AD","Andorra","1"],
["AE","United Arab Emirates","2"],
["AF","Afghanistan","3"],
["AG","Antigua  Barbuda","4"],
["AI","Anguilla","1"],
["AL","Albania","2"],
["AM","Armenia","3"],
["AN","Netherlands Antilles","4"],
["AO","Angola","1"],
["AQ","Antarctica","2"],
["AR","Argentina","3"],
["AS","American Samoa","4"],
["AT","Austria","1"],
["AU","Australia","2"],
["AW","Aruba","3"],
["AZ","Azerbaijan","4"],
["BA","Bosnia and Herzegovina","1"],
["BB","Barbados","2"],
["BD","Bangladesh","1"],
["BE","Belgium","2"],
["BF","Burkina Faso","3"],
["BG","Bulgaria","4"],
["BH","Bahrain","1"],
["BI","Burundi","2"],
["BJ","Benin","3"],
["BM","Bermuda","4"],
["BN","Brunei Darussalam","1"],
["BO","Bolivia","2"],
["BR","Brazil","3"],
["BS","Bahama","4"],
["BT","Bhutan","1"],
["BU","Burma ","2"],
["BV","Bouvet Island","3"],
["BW","Botswana","4"],
["BY","Belarus","1"],
["BZ","Belize","2"],
["CA","Canada","3"],
["CC","Cocos Islands","4"],
["CF","Central African Republic","1"],
["CG","Congo","2"],
["CH","Switzerland","3"],
["CI","Côte D'ivoire","4"],
["CK","Cook Iislands","1"],
["CL","Chile","2"],
["CM","Cameroon","3"],
["CN","China","4"],
["CO","Colombia","1"],
["CR","Costa Rica","2"],
["CS","Czechoslovakia ","3"],
["CU","Cuba","4"],
["CV","Cape Verde","1"],
["CX","Christmas Island","2"],
["CY","Cyprus","3"],
["CZ","Czech Republic","4"],
["DD","German Democratic Republic ","1"],
["DE","Germany","2"],
["DJ","Djibouti","3"],
["DK","Denmark","4"],
["DM","Dominica","1"],
["DO","Dominican Republic","2"],
["DZ","Algeria","3"],
["EC","Ecuador","4"],
["EE","Estonia","1"],
["EG","Egypt","2"],
["EH","Western Sahara","3"],
["ER","Eritrea","4"],
["ES","Spain","1"],
["ET","Ethiopia","2"],
["FI","Finland","3"],
["FJ","Fiji","4"],
["FK","Falkland Islands","1"],
["FM","Micronesia","2"],
["FO","Faroe Islands","3"],
["FR","France","4"],
["FX","France, Metropolitan","1"],
["GA","Gabon","2"],
["GB","United Kingdom","3"],
["GD","Grenada","4"],
["GE","Georgia","1"],
["GF","French Guiana","2"],
["GH","Ghana","3"],
["GI","Gibraltar","4"],
["GL","Greenland","1"],
["GM","Gambia","2"],
["GN","Guinea","3"],
["GP","Guadeloupe","4"],
["GQ","Equatorial Guinea","1"],
["GR","Greece","2"],
["GS","South Georgia and the South Sandwich Islands","3"],
["GT","Guatemala","4"],
["GU","Guam","1"],
["GW","Guinea-Bissau","2"],
["GY","Guyana","3"],
["HK","Hong Kong","4"],
["HM","Heard  McDonald Islands","1"],
["HN","Honduras","2"],
["HR","Croatia","3"],
["HT","Haiti","4"],
["HU","Hungary","1"],
["ID","Indonesia","2"],
["IE","Ireland","3"],
["IL","Israel","4"],
["IN","India","1"],
["IO","British Indian Ocean Territory","2"],
["IQ","Iraq","3"],
["IR","Islamic Republic of Iran","4"],
["IS","Iceland","1"],
["IT","Italy","2"],
["JM","Jamaica","3"],
["JO","Jordan","4"],
["JP","Japan","1"],
["KE","Kenya","2"],
["KG","Kyrgyzstan","3"],
["KH","Cambodia","4"],
["KI","Kiribati","1"],
["KM","Comoros","2"],
["KN","St. Kitts and Nevis","3"],
["KP","Korea, Democratic People's Republic of","4"],
["KR","Korea, Republic of","1"],
["KW","Kuwait","2"],
["KY","Cayman Islands","3"],
["KZ","Kazakhstan","4"],
["LA","Lao People's Democratic Republic","1"],
["LB","Lebanon","2"],
["LC","Saint Lucia","3"],
["LI","Liechtenstein","4"],
["LK","Sri Lanka","1"],
["LR","Liberia","2"],
["LS","Lesotho","3"],
["LT","Lithuania","4"],
["LU","Luxembourg","1"],
["LV","Latvia","2"],
["LY","Libyan Arab Jamahiriya","3"],
["MA","Morocco","4"],
["MC","Monaco","1"],
["MD","Moldova, Republic of ","2"],
["MG","Madagascar","3"],
["MH","Marshall Islands","4"],
["ML","Mali","1"],
["MN","Mongolia","2"],
["MM","Myanmar","3"],
["MO","Macau","4"],
["MP","Northern Mariana Islands","1"],
["MQ","Martinique","2"],
["MR","Mauritania","3"],
["MS","Monserrat","4"],
["MT","Malta","1"],
["MU","Mauritius","2"],
["MV","Maldives","3"],
["MW","Malawi","4"],
["MX","Mexico","1"],
["MY","Malaysia","2"],
["MZ","Mozambique","3"],
["NA","Namibia","4"],
["NC","New Caledonia","1"],
["NE","Niger","2"],
["NF","Norfolk Island","3"],
["NG","Nigeria","4"],
["NI","Nicaragua","1"],
["NL","Netherlands","2"],
["NO","Norway","3"],
["NP","Nepal","4"],
["NR","Nauru","1"],
["NT","Neutral Zone ","2"],
["NU","Niue","3"],
["NZ","New Zealand","4"],
["OM","Oman","1"],
["PA","Panama","2"],
["PE","Peru","3"],
["PF","French Polynesia","4"],
["PG","Papua New Guinea","1"],
["PH","Philippines","2"],
["PK","Pakistan","3"],
["PL","Poland","4"],
["PM","St. Pierre  Miquelon","1"],
["PN","Pitcairn","2"],
["PR","Puerto Rico","3"],
["PT","Portugal","4"],
["PW","Palau","1"],
["PY","Paraguay","2"],
["QA","Qatar","3"],
["RE","Réunion","4"],
["RO","Romania","1"],
["RU","Russian Federation","2"],
["RW","Rwanda","3"],
["SA","Saudi Arabia","4"],
["SB","Solomon Islands","1"],
["SC","Seychelles","2"],
["SD","Sudan","3"],
["SE","Sweden","4"],
["SG","Singapore","1"],
["SH","St. Helena","2"],
["SI","Slovenia","3"],
["SJ","Svalbard  Jan Mayen Islands","4"],
["SK","Slovakia","1"],
["SL","Sierra Leone","2"],
["SM","San Marino","3"],
["SN","Senegal","4"],
["SO","Somalia","1"],
["SR","Suriname","2"],
["ST","Sao Tome  Principe","3"],
["SU","Union of Soviet","4"],
["SV","El Salvador","1"],
["SY","Syrian Arab Republic","2"],
["SZ","Swaziland","3"],
["TC","Turks  Caicos Islands","4"],
["TD","Chad","1"],
["TF","French Southern Territories","2"],
["TG","Togo","3"],
["TH","Thailand","4"],
["TJ","Tajikistan","1"],
["TK","Tokelau","2"],
["TM","Turkmenistan","3"],
["TN","Tunisia","4"],
["TO","Tonga","1"],
["TP","East Timor","2"],
["TR","Turkey","3"],
["TT","Trinidad  Tobago","4"],
["TV","Tuvalu","1"],
["TW","Taiwan, Province of China","2"],
["TZ","Tanzania, United Republic of","3"],
["UA","Ukraine","4"],
["UG","Uganda","1"],
["UM","United States Minor Outlying Islands","2"],
["US","United States of America","3"],
["UY","Uruguay","4"],
["UZ","Uzbekistan","1"],
["VA","Vatican City State (Holy See)","2"],
["VC","St. Vincent  the Grenadines","3"],
["VE","Venezuela","4"],
["VG","British Virgin Islands","1"],
["VI","United States Virgin Islands","2"],
["VN","Viet Nam","3"],
["VU","Vanuatu","4"],
["WF","Wallis  Futuna Islands","1"],
["WS","Samoa","2"],
["YD","Democratic Yemen ","3"],
["YE","Yemen","4"],
["YT","Mayotte","1"],
["YU","Yugoslavia","2"],
["ZA","South Africa","3"],
["ZM","Zambia","4"],
["ZR","Zaire","1"],
["ZW","Zimbabwe","2"]);


@job_id = ("AC_ACCOUNT","AC_MGR","AD_ASST","AD_PRES","AD_VP","FI_ACCOUNT","FI_MGR","HR_REP","IT_PROG","MK_MAN","MK_REP","PR_REP","PU_CLERK","PU_MAN","SA_MAN","SA_REP","SH_CLERK","ST_CLERK","ST_MAN");
@dept_id = ("10","20","30","40","50","60","70","80","90","100","110","120","130","140","150","160","           170","180","190","200","210","220","230","240","250","260","270");
@salary = ("50000","60000","70000","80000","90000","100000","110000","120000","130000","140000","150000","160000","170000");
@manager = ("100","101","102","103","104","105");


for ($count = 216; $count <=100216; $count++) 
{	
	$rand_job   = rand @job_id;
	$rand_dept  = rand @dept_id;
	$rand_sal   = rand @salary;
	$rand_mgr   = rand @manager;

	my $faker = Data::Faker->new();
	print "INSERT INTO EMPLOYEES (EMPLOYEE_ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE_NUMBER, HIRE_DATE, JOB_ID, SALARY, COMMISSION_PCT, MANAGER_ID, 	 DEPARTMENT_ID) VALUES (".$count.",'".$faker->first_name."','".$faker->last_name."','".$faker->first_name.$faker->last_name."', '515.123.4567', to_date('".$faker->sqldate."', 'YYYY-MM-DD'),'".$job_id[$rand_job]."',".$salary[$rand_sal].", NULL, ".$manager[$rand_mgr].", ".$dept_id[$rand_dept].");\n"; 

	print "INSERT INTO JOB_HISTORY (EMPLOYEE_ID, START_DATE, END_DATE, JOB_ID, DEPARTMENT_ID) VALUES (".$count.", TO_DATE('".$faker->sqldate."', 'YYYY-MM-DD'), TO_DATE('".$faker->sqldate."', 'YYYY-MM-DD'), '".$job_id[$rand_job]."', ".$dept_id[$rand_dept].");\n";
		
}
	
for $i ( 0 .. $#LoC ) 
{
 $z = "INSERT INTO COUNTRIES (COUNTRY_ID, COUNTRY_NAME, REGION_ID) VALUES ";
 $k = "('";
 for $j ( 0 .. $#{$LoC[$i]} ) 
 {
    $k = $k.$LoC[$i][$j]."','";
   
 }
   chop($k);
   chop($k);
   print $z."$k);\n";
}























